package com.alibaba.citrus.ots.platform.enhance.sdo;

import lombok.Getter;

import java.util.Arrays;

/**
 * @author zhoubc
 * @description: TODO
 * @date 2021/9/6 16:54
 */
public enum CommOperateTypeEnum {

    /**
     * 启用
     */
    ENABLE(1),

    /**
     * 禁用
     */
    DISABLE(-1),

    /**
     * 禁用2
     */
    DISABLE2(2);


    @Getter
    private int code;

    CommOperateTypeEnum(int code) {
        this.code = code;
    }

    public static CommOperateTypeEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        return Arrays.stream(CommOperateTypeEnum.values()).filter(source -> code == source.code).findFirst().orElse(null);
    }

}
